package com.sskj.app.config.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 张子艺
 * @packge com.currency.admin.config
 * @data 2019-01-16 09:41
 * @project currencycloud
 */
@Configuration
public class RedisConfig {
    @Autowired
    RedisProperties redisProperties;
    /**
     * 配置shiro redisManager
     * 使用的是shiro-redis开源插件
     *
     * @return
     */
    @Bean
    public MyRedisUtil redisManager() {
            System.err.println("adminCore正在初始化redis配置/.....");
            System.err.println("host/"+redisProperties.getHost());
            System.err.println("port/"+redisProperties.getPort());
        MyRedisUtil myRedisUtil = new MyRedisUtil();
        myRedisUtil.setHost(redisProperties.getHost());
        myRedisUtil.setPort(redisProperties.getPort());
        myRedisUtil.setExpire(1800);// 配置缓存过期时间
        myRedisUtil.setTimeout(0);
        //  redisManager.setPassword(password);
        return myRedisUtil;
    }

}
